package org.example.camundaapp.service;

import org.camunda.bpm.engine.history.HistoricActivityInstance;
import org.camunda.bpm.engine.history.HistoricTaskInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @className: HistoryService
 * @author: ZHRJ
 * @date: 2025-07-04 14:22
 * @Version: 1.0
 * @description:
 */
@Service
public class CamundaHistoryService {
    private final CamundaEngineService camundaEngineService;

    @Autowired
    public CamundaHistoryService(CamundaEngineService camundaEngineService) {
        this.camundaEngineService = camundaEngineService;
    }

    /**
     * 查询审批历史流程
     * @param processInstanceId 流程实例ID
     * @return 审批历史流程列表
     */
    public List<HistoricTaskInstance> getTaskHistory(String processInstanceId) {
        return camundaEngineService.getTaskHistory(processInstanceId);
    }

    /**
     * 获取流程历史
     * @param processInstanceId 流程实例id
     * @return 流程历史
     */
    public List<HistoricActivityInstance> getProcessHistory(String processInstanceId) {
        return camundaEngineService.getProcessHistory(processInstanceId);
    }
}
